package com.ey12.service;

import java.util.List;

import com.ey12.db.dao.GmContactDAO;
import com.ey12.db.domain.GmContact;

public class GmContactService {
	private GmContactDAO gmContactDAO;

	public GmContactDAO getGmContactDAO() {
		return gmContactDAO;
	}

	public void setGmContactDAO(GmContactDAO gmContactDAO) {
		this.gmContactDAO = gmContactDAO;
	}
	public List getqqList(){
		List list = gmContactDAO.findAll();
		if(list.size()>0){
			return list;
		}
		return null;
	}
	public void delqq(GmContact gm){
		gmContactDAO.delete(gm);
	}
	public void updateqq(GmContact gm){
		System.out.println(gm.getName()+gm.getQq()+gm.getRemark());
		gmContactDAO.saveOrUpdate(gm);
	}
	public void addNewQQ(GmContact gm){
		System.out.println(gm.getName()+gm.getQq()+gm.getRemark());
		gm.setId(null);
		gmContactDAO.saveOrUpdate(gm);
	}
	public String checkqq(String qq){
		List list = gmContactDAO.findByQq(qq);
		if(list.size()>0){
			return "yes";
		}
		return "no";
	}
}
